import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class GoodsColorService {
    constructor(@InjectModel('GoodsColor') private readonly goodColorModel) {}
    async find(where = {}, fields = null) {
        return await this.goodColorModel.find(where, fields).sort({ sort: 1 });
    }
    async create(goodColorInfo) {
        return await this.goodColorModel.create(goodColorInfo);
    }
    async update(goodColorInfo) {
        return await this.goodColorModel.updateOne({ _id: goodColorInfo._id }, goodColorInfo);
    }
    async delete(goodColorInfo) {
        return await this.goodColorModel.deleteOne(goodColorInfo);
    }
}
